# keep_price = 1
# sku = 10126501
# # 商品类别
# goodsType = '其它'
# # goodsType = {1:'仁和',2:'好礼好健康',3:'其它'}
# # 直降价
# cutPrice = 25
# # 成本价
# costPrice = 20
# # 三方原价
# topPrice = 30.04

#
# # 毛利率
# profitRate = (cutPrice-costPrice)/cutPrice
#
# # 折扣力度
# discount = cutPrice/topPrice
#
# if goodsType == '好礼好健康':
#     if profitRate >= 0.35:
#         print('系统自动通过,行直降价,毛利率：%s' %profitRate)
#     elif 0 <= profitRate < 0.35:
#         print('人工二级审批,执行直降价', profitRate)
#     elif profitRate < 0:
#         print('人工一级审批,执行直降价', profitRate)
#
# # 有竞对未二级审批，无竞对为一级审批
# if goodsType == '仁和':
#     if discount > 0.8:
#         print('系统自动通过，执行直降价', discount)
#     elif discount <= 0.8:
#         print('人工有竞对二级审批，执行直降价', discount)
#
# if goodsType == '其它':
#     if profitRate >= 0.2:
#         print('系统自动通过执行直降价', profitRate)
#     elif 0 <= profitRate < 0.2:
#         print('人工二级审批，执行直降价', profitRate)
#     elif profitRate < 0:
#         print('人工一级审批,执行直降价', profitRate)


# bi_comment = '美团O2O####$$$$100012####$$$$叮当快药灯市口四十五店####$$$$10188001####$$$$[俊宏]参茸三肾胶囊####$$$$0.3gx14粒x2板####$$$$OTC甲类####$$$$'+str(cutPrice)+'####$$$$'+ str(costPrice) +'####$$$$'+str(cutPrice)+'####$$$$德开医药（快速发全国）####$$$$'+str(topPrice)
# print(bi_comment)

# 有竞争对手
isrival=1
def auditConfig(goodsType, cutPrice, costPrice, topPrice,isrival=1):
    # 毛利率
    profitRate = (cutPrice - costPrice) / cutPrice
    # 折扣力度
    discount = cutPrice / topPrice
    if 0 < discount < 0.3:
        print('我是爆品')
    elif 0.3 <= discount < 0.98:
        print('我是折扣商品')

    if goodsType == '好礼好健康':
        if profitRate >= 0.35:
            print('系统自动通过,执行直降价,毛利率：%s，折扣系数：%s' % (profitRate, discount))
        elif 0 <= profitRate < 0.35:
            print('人工二级审批,执行直降价,毛利率：%s' % profitRate)
        elif profitRate < 0:
            print('人工一级审批,执行直降价,毛利率：%s' % profitRate)

    # 有竞对未二级审批，无竞对为一级审批
    if goodsType == '仁和':
        if discount > 0.8:
            print('系统自动通过，执行直降价,折扣系数：%s' % discount)
        elif discount <= 0.8:
            if isrival == 1:
                print('人工有竞对二级审批，执行直降价,折扣系数：%s' % discount)
            else:
                print('人工无竞对一级审批，执行直降价,折扣系数：%s' % discount)

    if goodsType == '其它':
        if profitRate >= 0.2:
            print('系统自动通过执行直降价,毛利率：%s，折扣系数：%s' % (profitRate, discount))
        elif 0 <= profitRate < 0.2:
            print('人工二级审批，执行直降价,毛利率：%s，折扣系数：%s' % (profitRate, discount))
        elif profitRate < 0:
            print('人工一级审批,执行直降价,毛利率：%s，折扣系数：%s' % (profitRate, discount))


auditConfig(goodsType='其它', cutPrice=22, costPrice=20, topPrice=55)
